package logic;

import java.util.HashMap;

public class StatsContainer {
	
	protected HashMap<Stat, String> stats;
	protected Class<? extends Stat> langClass;
	
	public StatsContainer(Stat[] keys) {
		stats = new HashMap<Stat, String>();
		
		for(Stat l : keys) {
			stats.put(l, "0");
		}
		
		langClass = keys[0].getClass();
	}
	
	public void increaseStat(Stat key) {
		increaseStat(key, 1);
	}
	
	public void increaseStat(Stat key, int amount) {
		updateStat(key, (getIntValue(key) + amount) + "");
	}
	
	public String getValue(Stat key) { return stats.get(key); }
	
	public int getIntValue(Stat key) { return Integer.valueOf(getValue(key)).intValue(); }
	
	public float getFloatValue(Stat key) { return Float.valueOf(getValue(key)).floatValue(); }
	
	public void updateStat(Stat key, String value) { stats.put(key, value); }
	
	public void updateStat(Stat key, int value) { updateStat(key, value + ""); }
	
	public void updateStat(Stat key, float value) { updateStat(key, value + ""); }
}